/*
 * Copyright 2012 yura.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.opu.db.obj.vis.domain.domains;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

/**
 * When table have reference to another table its means that one object 
 * have another object inside.
 * When table connected one to many, one table contain id of another table.
 * <pre>For example:
 * -t1-----      -t2---------
 * |id   PK|     |id PK     |
 * |name   |     |t1 Ref(t1)|
 * ---------     ------------
 * </pre>So t2.t1 will be this attribute.
 * @author yura
 */
@Root
public class ObjectAttribute extends AbstractAttributeEntry {
    
    @Element
    private ObjectId refferencedObjectId;
    @Element
    private String refferencedAttributeName;
    @Element
    private AttributeConnectionType connectionType;

    public ObjectId getRefferencedObjectId() {
        return refferencedObjectId;
    }

    public void setRefferencedObjectId(ObjectId refferencedObjectId) {
        this.refferencedObjectId = refferencedObjectId;
    }

    public String getRefferencedAttributeName() {
        return refferencedAttributeName;
    }

    public void setRefferencedAttributeName(String attributeName) {
        this.refferencedAttributeName = attributeName;
    }

    public AttributeConnectionType getConnectionType() {
        return connectionType;
    }

    public void setConnectionType(AttributeConnectionType connectionType) {
        this.connectionType = connectionType;
    }
    
    @Override
    public String toString() {
        return "ObjectAttribute{" + id + "description=" + description 
                + ", prioritys=" + prioritys + "refferencedObjectId=" 
                + refferencedObjectId + "connectionType" + connectionType + '}';
    }
    
    
}
